package com.example.smarthome.ui.secondbedroom;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.smarthome.databinding.FragmentSecondbedroomBinding;


public class SecondbedroomFragment extends Fragment {

    private FragmentSecondbedroomBinding binding;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        binding = FragmentSecondbedroomBinding.inflate(inflater, container, false);
        View root = binding.getRoot();

        binding.textView.setText("35"+"℃");

        binding.secondbedroomFengshan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent("com.example.activitytest.FENGSHAN_START");
                intent.addCategory("com.example.activitytest.SecondbedroomFENGSHANActivity");
                startActivity(intent);
                Log.i("SecondActivity","33");
            }
        });

        binding.secondbedroomLamp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.i("次卧灯泡开关", "onClick: ");
            }
        });
        binding.secondbedroomFan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.i("次卧风扇开关", "onClick: ");
            }
        });

        binding.secondbedroomTemperature.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent("com.example.activitytest.TEMPERATURE_START");
                intent.addCategory("com.example.activitytest.SecondbedroomTEMPERATUREActivity");
                startActivity(intent);
                Log.i("SecondActivity","second");
            }
        });

        return root;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
}